<html>
<head><meta charset="utf-8"><title>Override variance · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Override.20variance.html">Override variance</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="198393730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Override%20variance/near/198393730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Diggsey <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Override.20variance.html#198393730">(May 22 2020 at 00:07)</a>:</h4>
<p>I'm trying to change a type to use an <code>UnsafeCell</code> internally, however this makes the type parameter <em>invariant</em> instead of <em>covariant</em>. However, the safe interface to the type enforces that it can be used covariantly, despite the <code>UnsafeCell</code>. How can I force the type to be covariant again?</p>



<a name="198488507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Override%20variance/near/198488507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Override.20variance.html#198488507">(May 22 2020 at 20:01)</a>:</h4>
<p>I dont think this is currently possible</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>